//
//  AY_BookQianDCell2.m
//  AiYue
//
//  Created by boWen on 2023/11/3.
//

#import "AY_BookQianDCell2.h"

@interface AY_BookQianDCell2 ()
@property (nonatomic,strong) UIView * bg_View;//底部圆角

/** 标题  */
@property (strong,nonatomic) UILabel * topTitle;
@property (nonatomic, strong) UIImageView * leftImageView;
@property (nonatomic, strong) UILabel * topLabel;
@property (nonatomic, strong) UILabel * downLabel;
@property (nonatomic, strong) UIButton * goFinishBtn;

@end

@implementation AY_BookQianDCell2


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addAllSubviewsWithUI];
    }
    return self;
}




- (void)addAllSubviewsWithUI {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.contentView.backgroundColor = [UIColor clearColor];
    self.backgroundColor = [UIColor clearColor];
    
    self.bg_View = [AYTool createViewWithFrame:CGRectZero andBg:[UIColor whiteColor] andRadius:YNUM(13) andAddSubView:self.contentView];
    [self.bg_View mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.bottom.equalTo(self.contentView);
    }];
    
    
    self.topTitle = [AYTool createLabelWithFrame:CGRectZero andText:@"做任务赚金币" andTextColor:COLOR(@"#010101") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(16)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
    [self.topTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.bg_View).offset(YNUM(16));
        make.left.equalTo(self.bg_View).offset(YNUM(14));
        make.height.mas_equalTo(YNUM(26));
    }];
    
    self.leftImageView = [AYTool createImageViewWithFrame:CGRectZero andImage:YImage(@"icon_my_tx.png") andBg:COLOR_Bg andRadius:YNUM(19) andAddSubView:self.bg_View];
    [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.width.mas_offset(YNUM(44));
        make.left.equalTo(self.bg_View).offset(YNUM(12));
        make.bottom.equalTo(self.bg_View).offset(YNUM(-16));
    }];
    
    self.topLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"签到奖励" andTextColor:COLOR(@"#010101") andBgColor:nil andFont:[UIFont boldSystemFontOfSize:YNUM(14)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
    [self.topLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.leftImageView).offset(YNUM(3));
        make.left.equalTo(self.leftImageView.mas_right).offset(YNUM(10));
        make.height.mas_equalTo(YNUM(22));
    }];
    
    self.downLabel = [AYTool createLabelWithFrame:CGRectZero andText:@"" andTextColor:COLOR(@"#909090") andBgColor:nil andFont:[UIFont systemFontOfSize:YNUM(12)] andLines:1 andRadius:0 andAddSubView:self.bg_View];
    [self.downLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.leftImageView);
        make.left.equalTo(self.topLabel);
        make.height.mas_equalTo(YNUM(20));
    }];
    
    
//    self.goFinishBtn = [AYTool createButtonWithFrame:CGRectZero andTitle:@"去完成" andFont:[UIFont boldSystemFontOfSize:YNUM(14)] andTitleColor:COLOR(@"#FFFFFF") andBg:COLOR(@"#F86923") andImage:nil andBgImage:nil andTarget:self andAction:@selector(goFinishWithAction) andRadius:YNUM(14) andAddSubView:self.bg_View];
//    [self.goFinishBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.right.equalTo(self.bg_View).offset(YNUM(-16));
//        make.centerY.equalTo(self.bg_View);
//        make.height.mas_equalTo(YNUM(28));
//        make.width.mas_equalTo(YNUM(75));
//    }];
}

- (void)setSignModel:(SignOwnModel *)signModel {
    _signModel = signModel;
    self.downLabel.text = [NSString stringWithFormat:@"已连续签到%@天", kStringUtils(_signModel.signDays)];
}



- (void)goFinishWithAction {
    
}


- (void)setFrame:(CGRect)frame {
    frame.origin.x += 16;
    frame.size.width -= 2 * 16;
    [super setFrame:frame];
}



@end
